package com.uzai.console.web.sop;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.sop.sopprirewardrulestrategy.SopPriRewardRuleStrategyDto;
import com.uzai.console.dto.sop.sopprirewardrulestrategy.SopPriRewardRuleStrategyIdDto;
import com.uzai.console.dto.sop.sopprirewardrulestrategy.SopPriRewardRuleStrategyQuery;
import com.uzai.console.service.sop.SopPriRewardRuleStrategyService;
import com.uzai.console.vo.base.SelectKeyVo;
import com.uzai.console.vo.sop.sopprirewardrulestrategy.SopPriRewardRuleStrategyVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * SOP定向规则策略
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "SOP定向规则策略",tags = "SOP任务|SOP定向规则策略")
@ApiSort(31)
@RestController
public class SopPriRewardRuleStrategyController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(SopPriRewardRuleStrategyController.class);

    @Autowired
    private SopPriRewardRuleStrategyService sopPriRewardRuleStrategyService;

    @ApiOperation(value = "分页查询SOP定向规则策略列表", notes = "分页查询SOP定向规则策略列表", response = SopPriRewardRuleStrategyVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/sopPriRewardRuleStrategy/findByPage")
    public Object findSopPriRewardRuleStrategyPage(@RequestBody SopPriRewardRuleStrategyQuery sopPriRewardRuleStrategyQuery){
        return sopPriRewardRuleStrategyService.findByPage(sopPriRewardRuleStrategyQuery);
    }

    @ApiOperation(value = "查询SOP定向规则策略详情", notes = "查询SOP定向规则策略详情", response = SopPriRewardRuleStrategyVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/sopPriRewardRuleStrategy/findById")
    public Object findSopPriRewardRuleStrategy(@RequestBody SopPriRewardRuleStrategyIdDto sopPriRewardRuleStrategyIdDto){
        return sopPriRewardRuleStrategyService.findById(sopPriRewardRuleStrategyIdDto);
    }


    @ApiOperation(value = "添加SOP定向规则策略", notes = "添加SOP定向规则策略")
    @ApiOperationSupport(order = 4)
    @PostMapping("/sopPriRewardRuleStrategy/add")
    public Object addSopPriRewardRuleStrategy(@RequestBody SopPriRewardRuleStrategyDto sopPriRewardRuleStrategyDto){
        sopPriRewardRuleStrategyService.addSopPriRewardRuleStrategy(sopPriRewardRuleStrategyDto);
        return true;
    }

    @ApiOperation(value = "删除SOP定向规则策略", notes = "删除SOP定向规则策略")
    @ApiOperationSupport(order = 3)
    @PostMapping("/sopPriRewardRuleStrategy/delete")
    public Object deleteSopPriRewardRuleStrategy(@RequestBody SopPriRewardRuleStrategyIdDto sopPriRewardRuleStrategyIdDto){
        sopPriRewardRuleStrategyService.deleteSopPriRewardRuleStrategy(sopPriRewardRuleStrategyIdDto);
        return true;
    }

    @ApiOperation(value = "修改SOP定向规则策略", notes = "修改SOP定向规则策略")
    @ApiOperationSupport(order = 4)
    @PostMapping("/sopPriRewardRuleStrategy/update")
    public Object updateSopPriRewardRuleStrategy(@RequestBody SopPriRewardRuleStrategyDto sopPriRewardRuleStrategyDto){
        sopPriRewardRuleStrategyService.updateSopPriRewardRuleStrategy(sopPriRewardRuleStrategyDto);
        return true;
    }

    @ApiOperation(value = "查询所有SOP定向规则策略下拉列表", notes = "查询所有SOP定向规则策略下拉列表", response = SelectKeyVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/sopPriRewardRuleStrategy/findSelectList")
    public Object findSelectList(@RequestBody SopPriRewardRuleStrategyQuery sopPriRewardRuleStrategyQuery){
        return sopPriRewardRuleStrategyService.findSelectList(sopPriRewardRuleStrategyQuery);
    }
}
